﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace weighing
{
    /// <summary>
    /// 是否可以 取消出场（重先出场）
    /// </summary>
    public class BillRepetitionOutConveter : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            WeighingBillVo bill = value as WeighingBillVo;
            if(bill == null)
            {
                return false;
            }
            if (bill.Type == (int)WeightingBillType.Sale) {

                if (App.Config.WeighingConfig.OutTimes == 2 && bill.Status == 1)
                {
                    return true;
                }
            }
            else
            {
                if (App.Config.WeighingConfig.Times == 2 && bill.Status == 1)
                {
                    return true;
                }
            }
           return false;
        }


        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }


    }
}
